* Replication of Tables and Figures for State Legislative Elections

* This file enables replication of the results as well as tables and figures related to state legislative elections in STATA.
* Created using STATA 16.1.

*** Table 1: Random Effects Logistic Regrssion Models of the Election of Asian American State Legislators

* State Legislators, 32 States: Combination Population
melogit asian paspop_ac if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(paspop_ac)

* State Legislators, 32 States: Alone Population
melogit asian paspop if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(paspop)

* State Legislators, 32 States: Alone VAP
melogit asian pasvap if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(pasvap)

* State Legislators, 32 States: Alone Citizen VAP
melogit asian pascvap if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(pascvap)

* Hawaii: Combination Population
melogit asian paspop_ac if hi==1 || panel: , intpoints(100) vce(robust)
margins, dydx(paspop_ac)



*** Table 2: Random Effeccts Logistic Regression Models of the Election of Asian American State Legislators that Include Intergroup or Intragroup Diversity, Excludes Hawaii

* Model 1
melogit asian pasvap divers c.pasvap#c.divers if hi==0 || panel: , intpoints(100) vce(robust)

* Model 2
melogit asian pasvap div_aa c.pasvap#c.div_aa if hi==0 || panel: , intpoints(100) vce(robust)



*** Figure 1: Asian American Legislators by Election Year and Party
* For Figure 1A: State Legislators, see totals across all 33 states from Supplementary Tables 2A and 2B.
* For Figure 1B: Congress, see totals from Supplementary Table 2C.



*** Figure 3: Asian American State Legislators by Ethnic Origin and Year
* See totals by year from Supplementary Tables 4A and 4B.



*** Figure 4: Percent Asian American State Legislators by Asian Alone or in Combination Population
* For 32 States, see Supplementary Table 6A.
* For Hawaii, see Supplementary Table 7A; the 70%-80% and 80%-90% categories in the table have been merged into a single 70%-90% category in Figure 4.



*** Figure 5: Percent Asian and the Estimated Probability of an Asian State Legislator in Hawaii and 32 Other States
* Data to create graph generated from the models in Table 1. The following code generates the data needed to recreate the graph as well as separate STATA graphs of each curve in Figure 5.

* 32 States: Asian Alone or in Combination Population
melogit asian paspop_ac if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(paspop_ac=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))

* 32 States: Asian Alone VAP
melogit asian pasvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pasvap=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))

* 32 States: Asian Alone Citizen VAP
melogit asian pascvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pascvap=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))

* Hawaii: Asian Alone or in Combination Population
melogit asian paspop_ac if hi==1 || panel: , intpoints(100) vce(robust)
margins , at(paspop_ac=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))



*** Figure 8: Estimated Probability of Asian, Black or Latino Legislator by Group CVAP
* Data to create graph generated from the models in Table 1 and Supplementary Table 9. The following code generates the data needed to recreate the graph as well as separate STATA graphs of each curve in Figure 8.

* 32 States: Asian Alone Citizen VAP
melogit asian pascvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pascvap=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))

* 32 States: Black Alone, Citizen VAP (Percent Hispanic CVAP set to 0)
melogit black pbcvap phcvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pbcvap=(0(.01).8) phcvap=0) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))

* 32 States: Hispanic Citizen VAP
melogit latino phcvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(phcvap=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))



*** Figure 9: Percent Asian American Legislators in 2020 by District Diversity (excl. HI)
* For U.S. House, see the Congress dataset.
* For State Legislatures, see Supplementary Table 6E.



*** Figure 10: Estimated Probability of an Asian American State Legislator as Intergroup Diversity Varies with 95% Confidence Intervals
* Model is the same as Model 1 in Table 2. The code below generates the data needed to recreate Figure 10 as well as a STATA version.

melogit asian pasvap divers c.pasvap#c.divers if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(divers=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) xtitle(Intergroup Diversity (Herfindahl index)) title(Figure 10: Intergroup Diversity in State Legislative Elections)



*** Supplementary Table 2A: Asian State Representatives by Election Year and Party
* Totals for 2011-12 include 4 MD Dems elected in 2010.
* Totals for 2015-16 include 7 MD Dems elected in 2014.
* Totals for 2019-20 include 8 MD Dems elected in 2018.
tab stname party if asian==1 & eyear>=2011 & eyear<=2012 & senate==0
tab stname party if asian==1 & eyear>=2013 & eyear<=2014 & senate==0
tab stname party if asian==1 & eyear>=2015 & eyear<=2016 & senate==0
tab stname party if asian==1 & eyear>=2017 & eyear<=2018 & senate==0
tab stname party if asian==1 & eyear>=2019 & eyear<=2020 & senate==0



*** Supplementary Table 2B: Asian State Senators by Election Year and Party
* Sitting senators who were not up for election are included in the table.
* 2011-12 results include 3 CA Dems, 1 MI Dem & 2 WA Dems elected previously.
* 2013-14 results include 1 CA Dem, 9 HI Dems, 1 MN Dem & 1 WA Dem elected previously.
* 2015-16 results include 2 CA Dems, 1 CA Rep, 8 HI Dems, 1 MD Dem, 1 MI Dem & 2 WA Dems elected previously.
* 2017-18 results include 9 HI Dems, 1 MN Dem & 1 WA Dem elected previously.
* 2019-20 results include 1 AK Dem, 1 CA Dem, 6 HI Dems, 2 MD Dems, 1 MI Dem, 1 NJ Dem, 1 OH Dem & 4 WA Dems elected previously.
tab stname party if asian==1 & eyear>=2011 & eyear<=2012 & senate==1
tab stname party if asian==1 & eyear>=2013 & eyear<=2014 & senate==1
tab stname party if asian==1 & eyear>=2015 & eyear<=2016 & senate==1
tab stname party if asian==1 & eyear>=2017 & eyear<=2018 & senate==1
tab stname party if asian==1 & eyear>=2019 & eyear<=2020 & senate==1



*** Supplementary Table 2C: Asian Federal Legislators by Election Year and Party
* See the Congress dataset.



*** Supplementary Table 4A: Asian Legislators by Ethnic Origin, State Representatives
* See table note on multiethnic Asian representatives.
* MD holds elections every four years. The 2011-12, 2015-16 and 2019-20 results include 1 Chinese, 1 Filipino & 2 Indian representatives elected previously. The 2015-16 & 2019-20 results include 1 Korean & 1 Pakistani representative elected previously. The 2019-20 results include 1 Nepali representative elected previously.
tab stname eyear if japanese==1 & senate==0
tab stname eyear if chinese==1 & senate==0
tab stname eyear if filipino==1 & senate==0
tab stname eyear if korean==1 & senate==0
tab stname eyear if vietnamese==1 & senate==0
tab stname eyear if indian==1 & senate==0
tab stname eyear if asian==1 & japanese==0 & chinese==0 & filipino==0 & korean==0 & vietnamese==0 & indian==0 & senate==0


*** Supplementary Table 4B: Asian Legislators by Ethnic Origin, State Senators
* See table note on multiethnic Asian senators.
* Sitting senators who were not up for election are included in the table but do not show up in the data resulting from the following code.

* For Japanese senators, need to add in 1 in AK in 2019-20, 5 in HI in 2013-14 and 2015-2016, 4 in HI in 2017-18 & 2019-20, and 1 in WA for all two-year cycles.
tab stname eyear if japanese==1 & senate==1

* For Chinese senators, need to add in 3 in CA in 2011-12; 1 apiece in CA & HI in 2013-14; 2 in CA and 1 apiece in HI & MD in 2015-16; 1 in HI in 2017-18; and 2 in MD and 1 apiece in CA, HI & MI in 2019-20.
tab stname eyear if chinese==1 & senate==1

* For Filipino senators in HI, need to add in 3 in 2013-14, 2 in 2015-16, 4 in 2017-18, and 1 in 2019-20.
tab stname eyear if filipino==1 & senate==1

* For Korean senators, this includes 1 apiece in MI & WA in 2011-12, 1 in HI in 2013-14, 1 apiece in MI & NJ in 2015-16, and 1 in HI in 2017-18.
tab stname eyear if korean==1 & senate==1

* For Vietnamese senators, need to add in 1 in CA in 2015-16, and 1 in WA in 2019-20.
tab stname eyear if vietnamese==1 & senate==1

* For Indian senators, need to add in 1 in WA in 2015-16; 2 in WA and 1 apiece in IL & NJ in 2019-20. 
tab stname eyear if indian==1 & senate==1

* In MN, need to add in 1 Hmong senator in 2013-14 & 2017-18. In OH, need to add in 1 (non-Hmong) Laotian in 2019-20.
tab stname eyear if asian==1 & japanese==0 & chinese==0 & filipino==0 & korean==0 & vietnamese==0 & indian==0 & senate==1


*** Supplementary Table 4C: Asian Legislators by Ethnic Origin, Federal Legislators 
* See the Congress dataset.



*** Supplementary Table 5: Asian Legislators by Ethnic Origin and Election Year

* State Representatives
* Need to add 4 MD Dems elected in 2008 (1 Chinese, 1 Filipino and 2 Indian) to totals for 2011-12; 7 MD Dems elected in 2014 to 2015-2016 (1 Chinese, 1 Filipino, 2 Korean, 2 Indian and 1 Pakistani); and 8 MD Dems elected in 2018 to 2019-2020 (1 Chinese, 1 Filipino, 2 Korean, 2 Indian, 1 Nepali and 1 Pakistani).
tab party if japanese==1 & eyear>=2011 & eyear<=2012 & senate==0
tab party if japanese==1 & eyear>=2013 & eyear<=2014 & senate==0
tab party if japanese==1 & eyear>=2015 & eyear<=2016 & senate==0
tab party if japanese==1 & eyear>=2017 & eyear<=2018 & senate==0
tab party if japanese==1 & eyear>=2019 & eyear<=2020 & senate==0

tab party if chinese==1 & eyear>=2011 & eyear<=2012 & senate==0
tab party if chinese==1 & eyear>=2013 & eyear<=2014 & senate==0
tab party if chinese==1 & eyear>=2015 & eyear<=2016 & senate==0
tab party if chinese==1 & eyear>=2017 & eyear<=2018 & senate==0
tab party if chinese==1 & eyear>=2019 & eyear<=2020 & senate==0

tab party if filipino==1 & eyear>=2011 & eyear<=2012 & senate==0
tab party if filipino==1 & eyear>=2013 & eyear<=2014 & senate==0
tab party if filipino==1 & eyear>=2015 & eyear<=2016 & senate==0
tab party if filipino==1 & eyear>=2017 & eyear<=2018 & senate==0
tab party if filipino==1 & eyear>=2019 & eyear<=2020 & senate==0

tab party if korean==1 & eyear>=2011 & eyear<=2012 & senate==0
tab party if korean==1 & eyear>=2013 & eyear<=2014 & senate==0
tab party if korean==1 & eyear>=2015 & eyear<=2016 & senate==0
tab party if korean==1 & eyear>=2017 & eyear<=2018 & senate==0
tab party if korean==1 & eyear>=2019 & eyear<=2020 & senate==0

tab party if vietnamese==1 & eyear>=2011 & eyear<=2012 & senate==0
tab party if vietnamese==1 & eyear>=2013 & eyear<=2014 & senate==0
tab party if vietnamese==1 & eyear>=2015 & eyear<=2016 & senate==0
tab party if vietnamese==1 & eyear>=2017 & eyear<=2018 & senate==0
tab party if vietnamese==1 & eyear>=2019 & eyear<=2020 & senate==0

tab party if indian==1 & eyear>=2011 & eyear<=2012 & senate==0
tab party if indian==1 & eyear>=2013 & eyear<=2014 & senate==0
tab party if indian==1 & eyear>=2015 & eyear<=2016 & senate==0
tab party if indian==1 & eyear>=2017 & eyear<=2018 & senate==0
tab party if indian==1 & eyear>=2019 & eyear<=2020 & senate==0

tab party if hmong==1 & eyear>=2011 & eyear<=2012 & senate==0
tab party if hmong==1 & eyear>=2013 & eyear<=2014 & senate==0
tab party if hmong==1 & eyear>=2015 & eyear<=2016 & senate==0
tab party if hmong==1 & eyear>=2017 & eyear<=2018 & senate==0
tab party if hmong==1 & eyear>=2019 & eyear<=2020 & senate==0

list eyear stname district win_name party ethnicity if asian==1 & japanese==0 & chinese==0 & filipino==0 & korean==0 & vietnamese==0 & indian==0 & hmong==0 & senate==0


* State Senators
* Sitting senators who were not up for election are included in the table but do not show up in the data resulting from the following code.
* Note that need to add 3 CA Dems, 1 MI Dem & 2 WA Dems to first set

* For Japanese senators, need to also include 1 Dem in AK in 2019-20, 5 Dems in HI in 2013-14 and 2015-2016, 4 Dems in HI in 2017-18 & 2019-20, and 1 Dem in WA for all two-year cycles.
tab party if japanese==1 & eyear>=2011 & eyear<=2012 & senate==1
tab party if japanese==1 & eyear>=2013 & eyear<=2014 & senate==1
tab party if japanese==1 & eyear>=2015 & eyear<=2016 & senate==1
tab party if japanese==1 & eyear>=2017 & eyear<=2018 & senate==1
tab party if japanese==1 & eyear>=2019 & eyear<=2020 & senate==1

* For Chinese senators, need to also include 3 CA Dems in 2011-12; 1 CA Dem & 1 HI Dem in 2013-14; 2 CA Dems,  1 HI Dem & 1 MD Dem in 2015-16; 1 HI Dem in 2017-18; and 2 MD Dems, 1 CA Dem, 1 HI Dem & 1 MI Dem in 2019-20.
tab party if chinese==1 & eyear>=2011 & eyear<=2012 & senate==1
tab party if chinese==1 & eyear>=2013 & eyear<=2014 & senate==1
tab party if chinese==1 & eyear>=2015 & eyear<=2016 & senate==1
tab party if chinese==1 & eyear>=2017 & eyear<=2018 & senate==1
tab party if chinese==1 & eyear>=2019 & eyear<=2020 & senate==1

* For Filipino senators, need to also include 3 HI Dems in 2013-14, 2 HI Dems in 2015-16, 4 HI Dems in 2017-18, and 1 HI Dem in 2019-20.
tab party if filipino==1 & eyear>=2011 & eyear<=2012 & senate==1
tab party if filipino==1 & eyear>=2013 & eyear<=2014 & senate==1
tab party if filipino==1 & eyear>=2015 & eyear<=2016 & senate==1
tab party if filipino==1 & eyear>=2017 & eyear<=2018 & senate==1
tab party if filipino==1 & eyear>=2019 & eyear<=2020 & senate==1

* For Korean senators, need to also include 1 MI Dem & 1 WA Dem in 2011-12, 1 HI Dem in 2013-14, 1 MI Dem & 1 NJ Rep in 2015-16, and 1 HI Dem in 2017-18.
tab party if korean==1 & eyear>=2011 & eyear<=2012 & senate==1
tab party if korean==1 & eyear>=2013 & eyear<=2014 & senate==1
tab party if korean==1 & eyear>=2015 & eyear<=2016 & senate==1
tab party if korean==1 & eyear>=2017 & eyear<=2018 & senate==1
tab party if korean==1 & eyear>=2019 & eyear<=2020 & senate==1

* For Vietnamese senators, need to add in 1 CA Rep in 2015-16, and 1 WA Dem in 2019-20.
tab party if vietnamese==1 & eyear>=2011 & eyear<=2012 & senate==1
tab party if vietnamese==1 & eyear>=2013 & eyear<=2014 & senate==1
tab party if vietnamese==1 & eyear>=2015 & eyear<=2016 & senate==1
tab party if vietnamese==1 & eyear>=2017 & eyear<=2018 & senate==1
tab party if vietnamese==1 & eyear>=2019 & eyear<=2020 & senate==1

* For Indian senators, need to add in 1 WA Dem in 2015-16; and 2 WA Dems, 1 IL Dem & 1 NJ Dem in 2019-20. 
tab party if indian==1 & eyear>=2011 & eyear<=2012 & senate==1
tab party if indian==1 & eyear>=2013 & eyear<=2014 & senate==1
tab party if indian==1 & eyear>=2015 & eyear<=2016 & senate==1
tab party if indian==1 & eyear>=2017 & eyear<=2018 & senate==1
tab party if indian==1 & eyear>=2019 & eyear<=2020 & senate==1

* The one non-Hmong Laotian senator is also coded as Hmong. Can identify specific ethnicity with the "ethnicity" variable. Need to add in 1 Hmong MN Dem in 2013-14 & 2017-18. I=In the Laotian row, need to add 1 (non-Hmong) Laotian OH Dem in 2019-20 (as well as include for 2017-18, which shows up in the data generated below).
tab party if hmong==1 & eyear>=2011 & eyear<=2012 & senate==1
tab party if hmong==1 & eyear>=2013 & eyear<=2014 & senate==1
tab party if hmong==1 & eyear>=2015 & eyear<=2016 & senate==1
tab party if hmong==1 & eyear>=2017 & eyear<=2018 & senate==1
tab party if hmong==1 & eyear>=2019 & eyear<=2020 & senate==1

* See the Hmong category above for information on the non-Hmong Laotian senator.
list eyear stname district win_name party ethnicity if asian==1 & japanese==0 & chinese==0 & filipino==0 & korean==0 & vietnamese==0 & indian==0 & hmong==0 & senate==1


* U.S. Representatives and U.S. Senators
* See the Congress dataset.



*** Supplementary Table 6: Percent Asian Elected by District Racial Composition after the 2020 Elections, Excluding Hawaii
* See the Congress dataset for U.S. House data.

* A. Percent Asian Alone or in Combination of Population
tab asian if paspop_ac>=0 & paspop_ac<.1 & recentreg==1 & hi==0
tab asian if paspop_ac>=.1 & paspop_ac<.2 & recentreg==1 & hi==0
tab asian if paspop_ac>=.2 & paspop_ac<.3 & recentreg==1 & hi==0
tab asian if paspop_ac>=.3 & paspop_ac<.4 & recentreg==1 & hi==0
tab asian if paspop_ac>=.4 & paspop_ac<.5 & recentreg==1 & hi==0
tab asian if paspop_ac>=.5 & paspop_ac<.6 & recentreg==1 & hi==0
tab asian if paspop_ac>=.6 & paspop_ac<.7 & recentreg==1 & hi==0
tab asian if paspop_ac>=.7 & paspop_ac<=1 & recentreg==1 & hi==0

* B. Percent Asian Alone of Population
tab asian if paspop>=0 & paspop<.1 & recentreg==1 & hi==0
tab asian if paspop>=.1 & paspop<.2 & recentreg==1 & hi==0
tab asian if paspop>=.2 & paspop<.3 & recentreg==1 & hi==0
tab asian if paspop>=.3 & paspop<.4 & recentreg==1 & hi==0
tab asian if paspop>=.4 & paspop<.5 & recentreg==1 & hi==0
tab asian if paspop>=.5 & paspop<.6 & recentreg==1 & hi==0
tab asian if paspop>=.6 & paspop<.7 & recentreg==1 & hi==0
tab asian if paspop>=.7 & paspop<=1 & recentreg==1 & hi==0

* C. Percent Asian Alone of Voting-Age Population
tab asian if pasvap>=0 & pasvap<.1 & recentreg==1 & hi==0
tab asian if pasvap>=.1 & pasvap<.2 & recentreg==1 & hi==0
tab asian if pasvap>=.2 & pasvap<.3 & recentreg==1 & hi==0
tab asian if pasvap>=.3 & pasvap<.4 & recentreg==1 & hi==0
tab asian if pasvap>=.4 & pasvap<.5 & recentreg==1 & hi==0
tab asian if pasvap>=.5 & pasvap<.6 & recentreg==1 & hi==0
tab asian if pasvap>=.6 & pasvap<.7 & recentreg==1 & hi==0
tab asian if pasvap>=.7 & pasvap<=1 & recentreg==1 & hi==0

* D. Percent Asian Alone of Citizen Voting-Age Population
tab asian if pascvap>=0 & pascvap<.1 & recentreg==1 & hi==0
tab asian if pascvap>=.1 & pascvap<.2 & recentreg==1 & hi==0
tab asian if pascvap>=.2 & pascvap<.3 & recentreg==1 & hi==0
tab asian if pascvap>=.3 & pascvap<.4 & recentreg==1 & hi==0
tab asian if pascvap>=.4 & pascvap<.5 & recentreg==1 & hi==0
tab asian if pascvap>=.5 & pascvap<.6 & recentreg==1 & hi==0
tab asian if pascvap>=.6 & pascvap<.7 & recentreg==1 & hi==0
tab asian if pascvap>=.7 & pascvap<=1 & recentreg==1 & hi==0

* E. Herfindahl Racial and Ethnic Diversity Index (Proportion)
tab asian if divers>=0 & divers<.1 & recentreg==1 & hi==0
tab asian if divers>=.1 & divers<.2 & recentreg==1 & hi==0
tab asian if divers>=.2 & divers<.3 & recentreg==1 & hi==0
tab asian if divers>=.3 & divers<.4 & recentreg==1 & hi==0
tab asian if divers>=.4 & divers<.5 & recentreg==1 & hi==0
tab asian if divers>=.5 & divers<.6 & recentreg==1 & hi==0
tab asian if divers>=.6 & divers<.7 & recentreg==1 & hi==0
tab asian if divers>=.7 & divers<.82 & recentreg==1 & hi==0



*** Supplementary Table 7: Percent Asian State Legislators Elected by District Racial Composition after the 2020 Elections, Hawaii

* A. Percent Asian Alone or in Combination of Population
tab asian if paspop_ac>=0 & paspop_ac<.1 & recentreg==1 & hi==1
tab asian if paspop_ac>=.1 & paspop_ac<.2 & recentreg==1 & hi==1
tab asian if paspop_ac>=.2 & paspop_ac<.3 & recentreg==1 & hi==1
tab asian if paspop_ac>=.3 & paspop_ac<.4 & recentreg==1 & hi==1
tab asian if paspop_ac>=.4 & paspop_ac<.5 & recentreg==1 & hi==1
tab asian if paspop_ac>=.5 & paspop_ac<.6 & recentreg==1 & hi==1
tab asian if paspop_ac>=.6 & paspop_ac<.7 & recentreg==1 & hi==1
tab asian if paspop_ac>=.7 & paspop_ac<.8 & recentreg==1 & hi==1
tab asian if paspop_ac>=.8 & paspop_ac<.9 & recentreg==1 & hi==1
tab asian if paspop_ac>=.9 & paspop_ac<=1 & recentreg==1 & hi==1

* B. Percent Asian Alone of Population
tab asian if paspop>=0 & paspop<.1 & recentreg==1 & hi==1
tab asian if paspop>=.1 & paspop<.2 & recentreg==1 & hi==1
tab asian if paspop>=.2 & paspop<.3 & recentreg==1 & hi==1
tab asian if paspop>=.3 & paspop<.4 & recentreg==1 & hi==1
tab asian if paspop>=.4 & paspop<.5 & recentreg==1 & hi==1
tab asian if paspop>=.5 & paspop<.6 & recentreg==1 & hi==1
tab asian if paspop>=.6 & paspop<.7 & recentreg==1 & hi==1
tab asian if paspop>=.7 & paspop<.8 & recentreg==1 & hi==1
tab asian if paspop>=.8 & paspop<.9 & recentreg==1 & hi==1
tab asian if paspop>=.9 & paspop<=1 & recentreg==1 & hi==1

* C. Percent Asian Alone of Voting-Age Population
tab asian if pasvap>=0 & pasvap<.1 & recentreg==1 & hi==1
tab asian if pasvap>=.1 & pasvap<.2 & recentreg==1 & hi==1
tab asian if pasvap>=.2 & pasvap<.3 & recentreg==1 & hi==1
tab asian if pasvap>=.3 & pasvap<.4 & recentreg==1 & hi==1
tab asian if pasvap>=.4 & pasvap<.5 & recentreg==1 & hi==1
tab asian if pasvap>=.5 & pasvap<.6 & recentreg==1 & hi==1
tab asian if pasvap>=.6 & pasvap<.7 & recentreg==1 & hi==1
tab asian if pasvap>=.7 & pasvap<.8 & recentreg==1 & hi==1
tab asian if pasvap>=.8 & pasvap<.9 & recentreg==1 & hi==1
tab asian if pasvap>=.9 & pasvap<=1 & recentreg==1 & hi==1

* D. Percent Asian Alone of Citizen Voting-Age Population
tab asian if pascvap>=0 & pascvap<.1 & recentreg==1 & hi==1
tab asian if pascvap>=.1 & pascvap<.2 & recentreg==1 & hi==1
tab asian if pascvap>=.2 & pascvap<.3 & recentreg==1 & hi==1
tab asian if pascvap>=.3 & pascvap<.4 & recentreg==1 & hi==1
tab asian if pascvap>=.4 & pascvap<.5 & recentreg==1 & hi==1
tab asian if pascvap>=.5 & pascvap<.6 & recentreg==1 & hi==1
tab asian if pascvap>=.6 & pascvap<.7 & recentreg==1 & hi==1
tab asian if pascvap>=.7 & pascvap<.8 & recentreg==1 & hi==1
tab asian if pascvap>=.8 & pascvap<.9 & recentreg==1 & hi==1
tab asian if pascvap>=.9 & pascvap<=1  & recentreg==1 & hi==1



*** Supplementary Table 9: Mixed Effects Logistic Regression Models of the Election of Black and Hispanic State Legislators, Excluding Hawaii

* Black Alone, All: VAP
melogit black pbvap phvap if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(pbvap)

* Black Alone, All: Citizen VAP
melogit black pbcvap phcvap if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(pbcvap)

* Black Alone, South: VAP
melogit black pbvap phvap if south==1 || panel: , intpoints(100) vce(robust)
margins, dydx(pbvap)

* Black Alone, South: Citizen VAP
melogit black pbcvap phcvap if south==1 || panel: , intpoints(100) vce(robust)
margins, dydx(pbcvap)

* Black Alone, Non-South: VAP
melogit black pbvap phvap if south==0 & hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(pbvap)

* Black Alone, Non-South: Citizen VAP
melogit black pbcvap phcvap if south==0 & hi==0 || panel: , intpoints(100) vce(robust) 
margins, dydx(pbcvap)

* Hispanic: VAP
melogit latino phvap if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(phvap)

* Hispanic: Citizen VAP
melogit latino phcvap if hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(phcvap)



*** Supplementary Table 10: Models of the Election of Asian American State Legislators, Excluding Hawaii

* Model 1
melogit asian pasvap pnhwvap c.nhwvap#c.pnhwvap if hi==0 || panel: , intpoints(100) vce(robust)

* Model 2
melogit asian pasvap pnhwvap c.nhwvap#c.pnhwvap c.pnhwvap#c.pnhwvap#c.pnhwvap if hi==0 || panel: , intpoints(100) vce(robust)

* Model 3
melogit asian pasvap pbvap c.pbvap c.pbvap#c.pbvap if hi==0 || panel: , intpoints(100) vce(robust)

* Model 4
melogit asian pasvap pbvap c.pbvap#c.pbvap c.pbvap#c.pbvap#c.pbvap if hi==0 || panel: , intpoints(100) vce(robust)

* Model 5
melogit asian pasvap phvap c.phvap#c.phvap if hi==0 || panel: , intpoints(100) vce(robust)

* Model 6
melogit asian pasvap phvap c.phvap#c.phvap c.phvap#c.phvap#c.phvap if hi==0 || panel: , intpoints(100) vce(robust)



*** Supplementary Table 11: Estimated Relationship of the Proportion College Graduates among Non-Asians to the Election of Asian Legislators, Excluding Hawaii

* Model
melogit asian pasvap divers c.pasvap#c.divers pnasn_col c.pasvap#c.pnasn_col if hi==0 || panel: , intpoints(100) vce(robust)



*** Supplementary Figure 1A: Estimated Probability of a Black Legislator by BVAP and Region
* The following code generates the data needed to recreate the graph as well as separate STATA graphs of each curve in the figure.

* Black Alone, South: VAP
melogit black pbvap phvap if south==1 || panel: , intpoints(100) vce(robust)
margins, dydx(pbvap)
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))

* Black Alone, Non-South: VAP
melogit black pbvap phvap if south==0 & hi==0 || panel: , intpoints(100) vce(robust)
margins, dydx(pbvap)
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))



*** Supplementary Figure 1B: Estimated Probability of a Black Legislator by BCVAP and Region
* The following code generates the data needed to recreate the graph as well as separate STATA graphs of each curve in the figure.

* Black Alone, South: Citizen VAP
melogit black pbcvap phcvap if south==1 || panel: , intpoints(100) vce(robust)
margins, dydx(pbcvap)
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))

* Black Alone, Non-South: Citizen VAP
melogit black pbcvap phcvap if south==0 & hi==0 || panel: , intpoints(100) vce(robust) 
margins, dydx(pbcvap)
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick))



*** Supplementary Figure 2: Impact of Non-Hispanic White (Squared Term)
melogit asian pasvap pnhwvap c.nhwvap#c.pnhwvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pnhwvap=(0(.01)1)) atmeans vsquish
marginsplot, xlabel(.0(.1)1) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) title(Supplementary Figure 2: Impact of Non-Hispanic White (Squared Term))


*** Supplementary Figure 3: Impact of Non-Hispanic White (Squared & Cubed)
melogit asian pasvap pnhwvap c.nhwvap#c.pnhwvap c.pnhwvap#c.pnhwvap#c.pnhwvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pnhwvap=(0(.01)1)) atmeans vsquish
marginsplot, xlabel(.0(.1)1) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) title(Supp. Figure 3: Impact of Non-Hispanic White (Squared & Cubed))


*** Supplementary Figure 4: Impact of Proportion Black (Squared Term)
melogit asian pasvap pbvap c.pbvap c.pbvap#c.pbvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pbvap=(0(.01)1)) atmeans vsquish
marginsplot, xlabel(.0(.1)1) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) title(Supplementary Figure 4: Impact of Proportion Black (Squared Term))


*** Supplementary Figure 5: Impact of Proportion Black (Squared & Cubed)
melogit asian pasvap pbvap c.pbvap#c.pbvap c.pbvap#c.pbvap#c.pbvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(pbvap=(0(.01)1)) atmeans vsquish
marginsplot, xlabel(.0(.1)1) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) title(Supplementary Figure 5: Impact of Proportion Black (Squared & Cubed))


*** Supplementary Figure 6: Impact of Proportion Hispanic (Squared Term)
melogit asian pasvap phvap c.phvap#c.phvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(phvap=(0(.01)1)) atmeans vsquish
marginsplot, xlabel(.0(.1)1) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) title(Supplementary Figure 6: Impact of Proportion Hispanic (Squared Term))


*** Supplementary Figure 7: Impact of Proportion Hispanic (Squared & Cubed)
melogit asian pasvap phvap c.phvap#c.phvap c.phvap#c.phvap#c.phvap if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(phvap=(0(.01)1)) atmeans vsquish
marginsplot, xlabel(.0(.1)1) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) title(Supp. Figure 7: Impact of Proportion Hispanic (Squared & Cubed))


*** Supplementary Figure 8: Impact of Pr Non-Asian College Graduates
melogit asian pasvap divers c.pasvap#c.divers pnasn_col c.pasvap#c.pnasn_col if hi==0 || panel: , intpoints(100) vce(robust)
margins , at(divers=(0(.01).8)) atmeans vsquish
marginsplot, xlabel(.0(.1).8) recast(line) recastci(rarea) ciopts(color(*.5)) plotopts(lw(medthick)) xtitle(Proportion Non-Asian College Graduates) title(Supplementary Figure 8: Impact of Pr Non-Asian College Graduates)

